﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Appraisal.Web.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script language="javascript">
        function printToExcel(html) {
            try {
                var ExApp = new ActiveXObject("Excel.Application")
                var ExWBk = ExApp.workbooks.add()
                var ExWSh = ExWBk.worksheets(1)
                ExApp.DisplayAlerts = false
                ExApp.visible = true
            } catch (err) {
                alert(err.description)
                return false
            }
            window.clipboardData.setData("Text", html);
            ExWBk.worksheets(1).Select;
            ExWBk.worksheets(1).Range("A1:Z900").NumberFormatLocal = "@";

            ExWBk.worksheets(1).Paste;
            //ExWBk.worksheets(1).Columns.AutoFit;
            //ExWBk.worksheets(1).Rows.AutoFit;
        }
        
        
		function excel()
		{

		    var newstr = document.all.item('p').innerHTML;
		    printToExcel(newstr);

		}
　　	 
    </script>
    <link href="CSS/defalut.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <table class="style1" border="1">
        <tr>
            <td>
                <asp:Button ID="btnExportExcel" runat="server" Text="excel" />
                <asp:Button ID="btnPDF" runat="server" onclick="btnPDF_Click" Text="PDF" />
            </td>
            <td>
                &nbsp;</td>
            <td colspan="3">
                &nbsp;</td>
            <td colspan="3">
                &nbsp;</td>
            <td colspan="2">
                &nbsp;</td>
        </tr>
    </table>
    <asp:Panel ID="p" runat="server">
    </asp:Panel>
    </form>
    </body>
</html>
